<template>
  <van-field name="checkbox" label-width="100" v-bind="$attrs" v-on="$listeners">
    <template #input>
      <van-checkbox
        shape="square"
        checked-color="#ec6616"
        v-bind="$attrs"
        v-on="$listeners"
        :value="value"
      />
    </template>
  </van-field>
</template>

<script>
export default {
  name: 'qt-checkbox',

  props: {
    value: Boolean,

    fieldName: {
      type: String,
      required: true,
    },
  },

  methods: {
    handleChange(value) {
      this.$emit('input', value, this.fieldName);
      this.$emit('change', value, this.fieldName);
    },
  },
};
</script>
